sortlistmodel: Make key generation part of the step function
authorBenjamin Otte <otte@redhat.com>
Tue, 21 Jul 2020 23:43:59 +0000 (01:43 +0200)
committerBenjamin Otte <otte@redhat.com>
Wed, 22 Jul 2020 12:30:49 +0000 (14:30 +0200)
commit5b18968867293dcb3af05f9b9a3c4109103cb664
treed4ada0939e37a19401f124b8004aaa0c2f592632
parente8c4e1205a51bd705c1daa1f8c069d3fc9d0144e
sortlistmodel: Make key generation part of the step function

SSave the missing keys as a bitset and iterate over that bitset in the
step function.

Solves the problem with a large UI block at the beginning of a sort
operation when all the keys were generated, in particular when key
generation was slow.

Benchmarks for maximum time taken by a single main loop callback:

     initial sort with complex GFileInfo keys
                       old      new
      32,000 items   137ms      3ms
     128,000 items   520ms     31ms

     initial sort with string keys
                       old      new
      32,000 items   187ms      1ms
     128,000 items   804ms      3ms
gtk/gtksortlistmodel.c